#ifndef COMMON_H
#define COMMON_H
#include <QString>
class local_socket;
#include <local_socket.h>
class tcp_socket;
#include <tcp_socket.h>
class M_Socket;
#include <m_socket.h>

struct LocalSocket_SendData
{
    LocalSocket_UnSendData(QString id,QString type,QString data,emit_type emittype,QString sockettype)
    {
        this->id=id;
        this->type=type;
        this->data=data;
        this->emittype=emittype;
        this->sockettype=sockettype;
    }
    QString id;
    QString type;
    QString data;
    emit_type emittype;
    QString sockettype;
};

class Common
{
public:
    Common();
    static QMap  <tcp_socket*,M_Socket*>  tcp_server_SocketMap;          //t_socketMAP
    static QReadWriteLock   tcp_server_SocketMapLock;                    //t_socket读写锁
    static QMap<local_socket*,M_Socket*>  localSocket_Map;               //l_socketMAP
    static QReadWriteLock   localSocket_MapLock;                         //l_socket读写锁
    static M_Socket* GetLocal_Socket();                                  //获取一个Localsocket
    static M_Socket* GetTcp_Socket();                                    //获取一个tcpsocket
    static QList<LocalSocket_SendData>      Localsocket_unsenddata;    //本地socket未发送的任务
    static QReadWriteLock   Localsocket_unsenddataLock;                  //本地socket未发送任务读写锁
    static QMap<QString,LocalSocket_SendData>      Localsocket_Caculatedata;  //本地socket正在处理的任务
    static QReadWriteLock   Localsocket_CaculatedataLock;               //本地socket正在处理任务锁
    static QStringList      Logdata;                                    //日志内容
    static QReadWriteLock   LogdataLock;                                //日志锁
    static QReadWriteLock   ConfigureLock;                              //配置锁
    static QString          Tcp_ip;                                     //连接tcp地址
    static int              Tcp_port;                                   //tcp端口
    static QString          LocalPort;                  //本地监听端口
    static int              Hand_Count;                                 //处理线程个数
    static int              Caculate_Count;
    static bool             Log_Open;                              //日志开启
    static int              Log_Size;                               //日志大小
};

#endif // COMMON_H
